src/pages/posts/[post].astro 760 B raw
1
---
2
import type { GetStaticPathsResult } from "astro";
3
import type { CollectionEntry } from "astro:content";
4
import { getCollection } from "astro:content";
5
import PostLayout from "@/layouts/BlogPost";
6
import MailForm from "@/components/blog/MailForm";
7
import MailForm2 from "@/components/blog/MailForm2";
8
9
export async function getStaticPaths(): Promise<GetStaticPathsResult> {
10
	const posts: CollectionEntry<"post">[] = await getCollection("post");
11
	const params = posts.map((post) => ({
12
		params: { post: post.slug },
13
		props: { post },
14
	}));
15
	return params;
16
}
17
18
interface Props {
19
	post: CollectionEntry<"post">;
20
}
21
22
const { post } = Astro.props;
23
const { Content } = await post.render();
24
---
25
26
<PostLayout post={post}>
27
	<Content />
28
  <MailForm2 />
29
</PostLayout>